function information(){} information.prototype = { statusAvailable : 1, statusBooked : 2, statusUnavailable : 3, statusError : 4, eventTextInformation : function(eventId, urlEvent = null){ console.log(urlEvent); this.sendRequest('/information/event-text-information/', eventId, urlEvent); }, eventTextBiometry : function(eventId, urlEvent = null){ console.log(urlEvent); this.sendRequest('/information/event-text-biometry', eventId, urlEvent); }, sendRequest : function(url, eventId, urlEvent = null){ var thisObject = this; let buttonOK = false; if(urlEvent !== null){ buttonOK = true; } $.ajax({ url: url, data: {event: eventId}, method: 'post', dataType: 'json', success: function(json) { var modal = new Modal({ title: json.title, body : '
'+json.text+'
', buttonOK : buttonOK, okText: 'Comprar', cancelText: 'Fechar', confirm: function(){ window.location.href = urlEvent; } }); modal.show(); }, }); }, } var information = new information();